home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
minmax_1
/
frmsubcl.frm
(
.txt
)
next >
Wrap
Visual Basic Form
|
1998-10-19
|
2KB
|
42 lines
VERSION 5.00
Begin VB.Form frmSubclass
AutoRedraw = -1 'True
Caption = "Min & Max Form Size Demo"
ClientHeight = 3885
ClientLeft = 1020
ClientTop = 930
ClientWidth = 6045
LinkTopic = "Form1"
ScaleHeight = 259
ScaleMode = 3 'Pixel
ScaleWidth = 403
Attribute VB_Name = "frmSubclass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' A demo project showing how to prevent the user from making a window smaller
' or larger than you want them to through subclassing the WM_GETMINMAXINFO message.
' by Bryan Stafford of New Vision Software
- newvision@imt.net
' this demo is released into the public domain "as is" without
' warranty or guaranty of any kind. In other words, use at
' your own risk.
Private Const GWL_WNDPROC As Long = (-4&)
' API call to alter the class data for this window
Private Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" (ByVal hWnd&, _
ByVal nIndex&, ByVal dwNewLong&)
Private Sub Form_Load()
' take control of message processing by installing our message handling
' routine into the chain of message routines for this window
procOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Private Sub Form_Unload(Cancel As Integer)
' give message processing control back to VB
' if you don't do this you WILL crash!!!
Call SetWindowLong(hWnd, GWL_WNDPROC, procOld)
End Sub